const fs = require('fs');


const UrlMap = {
    "main.html": './views/main.html',
    "forum-edit.html": './views/forum/forum-edit.html'
}
function map(page_name) {
    page_name = checkout_page_name(page_name);
    let data = UrlMap[page_name] ? UrlMap[page_name] : "";

    if (data === "") {
        return "";
    }

    data = fs.readFileSync(data, 'utf8');
    return data;
}

function checkout_page_name(page_name) {
    let ridx = page_name.lastIndexOf("/");
    if (ridx == -1) {
        return page_name;
    } else {
        return page_name.substring(ridx + 1);
    }
}

module.exports = map;
